package com.store.controller;

import com.store.from.StoreFrom;
import com.store.mapper.StoreMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/store")
public class StoreController {

    @Autowired
    private StoreMapper storeMapper;

    @Transactional(rollbackFor = Exception.class)
    @PostMapping("/count")
    public void minCount(@RequestBody StoreFrom from) {
        //System.out.println(Integer.valueOf("ada"));
        storeMapper.reduction(from);
    }
}
